package com.wbt.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @program: Thread-demo
 * @description: 组成最大数
 * @author: Wang·Baotong
 * @create: 2021-03-09 09:18
 */
public class MakeMax {

    /**
     *
     */
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        String str;
        while ((str=bf.readLine()) != null){
            String[] numArray = str.split(",");
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i<numArray.length-1;i++){
                for (int j = i+1; j< numArray.length ; j++){
                    for (int k= 0;k<Math.max(numArray[i].length(),numArray[j].length());k++){
                          if(Integer.parseInt(String.valueOf(numArray[i].charAt(numArray[i].length()> k?k:numArray[i].length()-1))) >
                             Integer.parseInt(String.valueOf(numArray[j].charAt(numArray[j].length()> k?k:numArray[j].length()-1))) ){
                              break;
                          }else if(Integer.parseInt(String.valueOf(numArray[i].charAt(numArray[i].length()> k?k:numArray[i].length()-1))) <
                                  Integer.parseInt(String.valueOf(numArray[j].charAt(numArray[j].length()> k?k:numArray[j].length()-1))) ){
                              String t = numArray[i];
                              numArray[i] = numArray[j];
                              numArray[j] = t;
                              break;
                          }
                    }
                }
                sb.append(numArray[i]);
            }
            sb.append(numArray[numArray.length-1]);
            System.out.println(sb.toString());

        }

    }
}
